trigger DeleteMCP on monthly_cooperation_plan_with_hospital__c (before delete) {
     
    if(system.trigger.isdelete){
    Profile p  = [select id from profile where name=: 'System Administrator' or name =: '系统管理员'];
     for (monthly_cooperation_plan_with_hospital__c mcp : Trigger.old)
     {
         if(
         (
         (
         (integer.valueof(mcp.Year__c) ==  date.today().year())&&(mcp.Month__c <= date.today().month())
         )||(integer.valueof(mcp.Year__c) <  date.today().year())
         )
         &&(p.id != UserInfo.getProfileId())){
             mcp.addError('该记录不能被删除!');
         }
     }
   }
}